<%@page import="bean.GuestBookVO"%>
<%@page import="java.util.ArrayList"%>
<%@page import="bean.GuestBookDTO"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>guestBook.jsp</title>
<link rel="stylesheet" href="/TestWeb/css/guestBook.css"/>
<script type="text/javascript" src="./js/guestBook.js"></script>
</head>
<body>
<jsp:useBean id="guestBook" class="bean.GuestBookVO" scope="page"/>
<jsp:setProperty property="*" name="guestBook"/>
	<%
		request.setCharacterEncoding("utf-8");
		
		GuestBookDTO dto = new GuestBookDTO();
		dto.setVo(guestBook);
		ArrayList<GuestBookVO> list = dto.select();
	
		
	%>
	<h3>방명록<a href ="index1.jsp?inc=./Community/guestBook.jsp"><input type='button' value='더보기' style="margin-left: 908px;"/></a></h3>
	<div id="allWrap" align="left" style="font-size: small;">
		<div id="guestBook_headerTitle" align="center">
				<div id="guestBook_headerTitle_rno">번호</div>
				<div id="guestBook_headerTitle_contents">한마디</div>
				<div id="guestBook_headerTitle_mid">아이디</div>
				<div id="guestBook_headerTitle_date">작성일</div>
		</div>
		<%
		if(list.size()>0)
		{
		for(int i=0; i<3; i++){ 
			GuestBookVO v = list.get(i);
			
			String date = v.getGuestbook_date();
			String[] date1 = date.split(" ");
		%>
		<div id="guestBook_contents" align="center" style="font-size: small;">
				<div id="guestBook_contents_rno"><%=v.getGuestbook_rno() %></div>
				<div id="guestBook_contents_contents"><%=v.getGuestbook_contents() %></div>
				<div id="guestBook_contents_mid"><%=v.getGuestbook_mid() %></div>
				<div id="guestBook_contents_date"><%=date1[0] %></div>
		</div>
		<%}} %>
	</div>	
</body>
<script type="text/javascript">init();</script>
</html>